package cn.edu.jju.stepcounter2.utils;

import java.util.Calendar;

/**
 * Created by roor on 2016/12/7.
 */

public class GetDate {

    public static String get() {
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1;
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        String dateStr =""+year+""+month+""+day;
        if (month < 10 && day >= 10) {
            dateStr = "" + year + "0" + month +""+ day;
        }
        if (month < 10 && day < 10) {
            dateStr = "" + year + "0" + month + "0" + day;
        }
        if (month >= 10 && day < 10) {
            dateStr = "" + year +""+ month + "0" + day;
        }


        return dateStr;

    }

}
